home *** CD-ROM | disk | FTP | other *** search
- /* simple benchmark for testing floating point speed of c libraries
- does repeated multiplications and divisions in a loop that is
- large enough to make the looping time insignificant */
-
- #define CONST1 3.141597E0
- #define CONST2 1.7839032E4
- #define COUNT 10000
-
- main()
- {
- double a, b, c;
- int i;
-
- a = CONST1;
- b = CONST2;
- for (i = 0; i < COUNT; ++i)
- {
- c = a * b;
- c = c / a;
- c = a * b;
- c = c / a;
- c = a * b;
- c = c / a;
- c = a * b;
- c = c / a;
- c = a * b;
- c = c / a;
- c = a * b;
- c = c / a;
- c = a * b;
- c = c / a;
- }
- printf ("Done\n");
- }